<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>交通事故列表-增加</title>
	<link rel="stylesheet" type="text/css" href="../resource/css/base.css" />
	<script type="text/javascript" src="../resource/js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="../resource/js/prototype.js"></script>
	<s:actionmessage/>
	<script type="text/javascript">
			function sumbit(){
				var form = document.forms[0];
				var orderId = document.getElementsByName("orderId")[0].value;
				var truckId = document.getElementsByName("truckId")[0].value;
				var driverId = document.getElementsByName("driverId")[0].value;
				var accidentTime = document.getElementsByName("accidentTime")[0].value;
				var location = document.getElementsByName("location")[0].value;
				
				if(orderId==""){
					alert("请选择订单号.");
					return false;
				}
				if(driverId == ""){
					alert("请选择驾驶员.");
					return false;
				}
				if(truckId == ""){
					alert("请选择车牌号.");
					return false;
				}
				if(accidentTime == ""){
					alert("请输入事发时间.");
					return false;
				}
				if(location == "" ){
					alert("请输入事发地点.");
					return false;
				}
				
				//正则表达式对象
				var pattern = /^[0-9]+(\.[0-9]{1,2}){0,1}$/;
				if (form.losses.value!=""&&!pattern.test(form.losses.value)){
					alert("经济损失数据格式错误，请重新输入.");
					return false;
				}
				if (form.fineCharge.value!=""&&!pattern.test(form.fineCharge.value)){
					alert("罚款数据格式错误，请重新输入.");
					return false;
				}
				if (form.claimFee.value!=""&&!pattern.test(form.claimFee.value)){
					alert("索赔差额数据格式错误，请重新输入.");
					return false;
				}
				
				form.action="add.action";
				form.submit();
			}
		</script>

</head>
<body  oncontextmenu="return false;" leftmargin="8" topmargin="8">
<div class="tip"><span>当前位置:</span>交通事故管理&nbsp;&gt;&nbsp;新增&nbsp;&gt;&nbsp;</div>
<s:form name="add" namespace="/costAccident">
<table class="edittb" cellpadding="2" cellspacing="1">
	<tr bgcolor="#EEF4EA">
		<td height="35" colspan="4">&nbsp;交通事故信息&nbsp;</td>
	</tr>
	<tr>
		<td class="coln"><SPAN style="color: red">*</SPAN> 货运单号</td>
		<td width="35%" class="colv">
			<s:textfield name="orderId" readOnly="readonly"/> <img src="../resource/image/menusearch.gif" style="cursor: pointer;">
		</td>
		<td class="coln"><SPAN style="color: red">*</SPAN> 车牌号</td>
		<td width="45%" class="colv">
			<s:select list="trucks" listKey="truckId" listValue="truckId" headerKey="" headerValue="-选择车牌号-"  name="truckId" cssStyle="width:80%"></s:select>
		</td>
	</tr>
	<tr>
		<td class="coln"><SPAN style="color: red">*</SPAN> 驾驶员</td>
		<td width="35%" class="colv">
			<s:select list="drivers" listKey="driverId" listValue="name"  name="driverId" cssStyle="width:80%"></s:select>
		</td>
		<td class="coln"><SPAN style="color: red">*</SPAN> 事发时间</td>
		<td width="45%" class="colv">
			 <s:textfield onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss'})"  cssClass="Wdate" name="accidentTime"></s:textfield>
		</td>
	</tr>
	<tr>
		<td class="coln"><SPAN style="color: red">*</SPAN> 事发地点</td>
		<td width="35%" class="colv">
			<s:textfield name="location"></s:textfield>
		</td>
		<td class="coln"> 经济损失</td>
		<td width="45%" class="colv">
			<s:textfield name="losses"></s:textfield> 元
		</td>
	</tr>
	<tr>
		<td class="coln">伤亡人数</td>
		<td width="35%" class="colv">
			<s:textfield name="toll"></s:textfield> 人
		</td>
		<td class="coln">事故责任</td>
		<td width="45%" class="colv">
			<s:select list="#{1:'全责',2:'半责',3:'无责'}" listKey="key" listValue="value" name="liability" cssStyle="width:80%"></s:select>
		</td>
	</tr>
	<tr>
		<td class="coln">罚款</td>
		<td width="35%" class="colv">
			<s:textfield name="fineCharge"></s:textfield> 元
		</td>
		<td class="coln">索赔差额</td>
		<td width="45%" class="colv">
			<s:textfield name="claimFee"></s:textfield> 元
		</td>
	</tr>
	<tr>
		<td class="coln">具体情况说明</td>
		<td colspan="3" class="colv">
			<s:textarea name="note"></s:textarea>
		</td>
	</tr>
	<tr align="right" bgcolor="#EEF4EA">
		<td height="35" colspan="4" align="center">
			<a href="javascript:history.go(-1)" class="coolbg">&nbsp;返&nbsp;回&nbsp;</a>
			<a href="#" class="coolbg" onclick="return sumbit();">&nbsp;保&nbsp;存&nbsp;</a>
			<a href="javascript:document.forms[0].reset()" class="coolbg">&nbsp;重&nbsp;置&nbsp;</a>
		</td>
	</tr>
</table>
</s:form>
</body>
<script type="text/javascript" src="../resource/js/popup/popup.js"></script>
<script type="text/javascript" src="../resource/js/popup/commonPopup.js"></script>
</html>
